﻿using ConfigUtility;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Xml.Serialization;

namespace VFTray.Config
{
	public class CfgWndLayout : IConfig
	{
		public List<WidthType> Width_col = new List<WidthType>();
		public List<WidthType> Height_row = new List<WidthType>();
		public List<WndObject> Objects = new List<WndObject>();
		public void afterLoad()
		{
			InitParamsClass();
		}

		public void InitParamsClass()
		{
			if (Width_col.Count == 0) Width_col.Add(new WidthType());
			if (Height_row.Count == 0) Height_row.Add(new WidthType());

			if (Objects.Count == 0)
			{
				Objects.Add(new WndObject()
				{
					Width_col = new List<WidthType>() { new WidthType() },
					Height_row = new List<WidthType>() { new WidthType() }
				});
			}
		}
	}

	public class WidthType
	{
		[XmlAttribute]
		public int Type = 2;//2percent;1Absolute
		[XmlAttribute]
		public float Width = 50F;
	}

	public class WndObject
	{
		[XmlAttribute]
		public string Name = "table";//tabel:picture:
		[XmlAttribute]
		public int col = 0;
		[XmlAttribute]
		public int row = 0;

		public List<WidthType> Width_col = new List<WidthType>();
		public List<WidthType> Height_row = new List<WidthType>();
		public List<WndObject> Objects = new List<WndObject>();
	}
}

